#ifndef ODB_CHAT_SESSION_MEMBER_HXX
#define ODB_CHAT_SESSION_MEMBER_HXX

#include <boost/date_time/posix_time/posix_time.hpp>
#include <odb/core.hxx>
#include <odb/nullable.hxx>
#include <string>

namespace chat {
#pragma db object table("session")
class ChatSessionMember {
   public:
    ChatSessionMember() = default;
    ChatSessionMember(const std::string& session_id, const std::string& user_id)
        : session_id_(session_id), user_id_(user_id) {}

    void user_id(const std::string& user_id) { user_id_ = user_id; }
    const std::string& user_id() const { return user_id_; }

    void session_id(const std::string& session_id) { session_id_ = session_id; }
    const std::string& session_id() const { return session_id_; }

   private:
    friend class odb::access;
#pragma db id auto
    unsigned long id_;
#pragma db type("VARCHAR(64)") index
    std::string session_id_;  // 会话id
#pragma db type("VARCHAR(64)")
    std::string user_id_;  // 用户id
};

using ChatSessionMemberPtr = std::shared_ptr<ChatSessionMember>;
}  // namespace chat

#endif  // ODB_CHAT_SESSION_MEMBER_HXX